<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset id="searchFieldset_currentTable" class="table-search-fieldset">
            <legend>{:lang("common.condition_search")}</legend>
            <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("common.start_month")}</label>
                    <div class="layui-input-inline">
                        <input name="d_progress_date_ge" class="layui-input cssDate"
                               placeholder="{:lang('common.choose')}{:lang('common.start_month')}"
                               value="{$param.d_progress_date_ge|default=''}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("common.end_month")}</label>
                    <div class="layui-input-inline">
                        <input name="d_progress_date_le" class="layui-input cssMonth"
                               placeholder="{:lang('common.choose')}{:lang('common.end_month')}"
                               value="{$param.d_progress_date_le|default=''}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("custom.name")}</label>
                    <div class="layui-input-inline">
                        <select name="c_id_eq" default-value="{$param.c_id_eq|default=''}" lay-search>
                            <option value="">{:lang("common.choose")}{:lang("custom.name")}</option>
                            {foreach :getMyCustomList() as $val}
                            <option value="{$val.id}">{$val.number}{$val.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>

                {if !auth('roleAccounting')}
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("accounting.name")}</label>
                    <div class="layui-input-inline">
                        <select name="a_id_eq" default-value="{$param.a_id_eq|default=''}" lay-search>
                            <option value="">{:lang("common.choose")}{:lang("accounting.name")}</option>
                            {foreach :getAccountingList() as $val}
                            <option value="{$val.id}">{$val.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                {/if}

                <div class="layui-form-item layui-inline" style="margin-left:50px">
                    <button type="submit" class="layui-btn layui-btn-normal" data-type="tableSearch"
                            lay-submit lay-filter="search_currentTable">{:lang("common.btn_search")}
                    </button>
                </div>
            </form>
        </fieldset>

        <table id="currentTable"
               data-auth-print="{:auth(request()->controller().'/print')}"
               data-auth-export="{:auth(request()->controller().'/export')}">
        </table>
    </div>
</div>
<script>
    layui.use(['myApp'], function () {
        var myCommon = layui.myCommon;
        myCommon.table.render({
            where: myCommon.generateCondition()
            , totalRow: true
            , limit: "{$param.limit|default='15'}"
            , cols: [[
                {
                    field: 'progress_date', width: 110, title: '{:lang("day.progress_date")}', sort: true
                    , templet: myCommon.table.fn, fn: function (value) {
                        return value + Date.parseDate(value, '%Y-%m-%d').print('[%a]');
                    }
                }
                , {field: 'accounting_name', width: 105, title: '{:lang("accounting.name")}', sort: true}
                , {field: 'custom_name', width: 160, title: '{:lang("custom.name")}', sort: true}
                , {field: 'content', minWidth: 100, title: '{:lang("day.content")}'}
                , {field: 'estimate_time', width: 90, title: '{:lang("common.estimate_time_alias")}', sort: true}
                , {field: 'actual_time', width: 90, title: '{:lang("common.actual_time_alias")}', sort: true}
                , {
                    field: 'completion_status', width: 90, title: '{:lang("day.completion_status")}', sort: true,
                    templet: myCommon.table.type, typeList: 'completion_status_list'
                }
            ]]
            , done: function (res) {
                myCommon.tableTotal(this, res.data, ['estimate_time', 'actual_time']);
            }
        });
        myCommon.listen();
    });
</script>
